using Microsoft.AspNetCore.Rewrite;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

//https://www.infoworld.com/article/3445867/how-to-use-url-rewriting-middleware-in-aspnet-core.html
var rewrite = new RewriteOptions();
// request url: /api/values/index
// rewrite url: /api/default/index
rewrite.AddRewrite("api/values", "api/default", true);
app.UseRewriter(rewrite);
app.UseAuthorization();
app.MapControllers();
app.Run();